package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—07—23
 * Time: 17:02
 */
public class Demo01 {
    public static void reflectPrivateConstructor() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
            Class<?> c1 = Class.forName("enumdemo.enumDemo01");
            Constructor<?> constructor =
                    c1.getDeclaredConstructor(String.class, int.class,String.class, int.class);
            constructor.setAccessible(true);

            enumDemo01 e1 = (enumDemo01)constructor.newInstance("xigua",66);
            System.out.println(e1);
    }

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        reflectPrivateConstructor();
    }
}
